package object;

public class IntegerDemo {
    public static void main(String[] args) {
        Integer i = 5;//基本类型到包装类-----------装箱
        //触发了自动拆箱特性，会被编译成 int j = int.valueOf(i);
        int j = i; //包装类型到基本类型-----------拆箱


        int maxValue = Integer.MAX_VALUE;
        int minValue = Integer.MIN_VALUE;
        System.out.println("最大值为"+maxValue+"，最小值为"+minValue);

        long maxValue1 = Long.MAX_VALUE;
        long minValue1 = Long.MIN_VALUE;
        System.out.println("最大值为"+maxValue1+"，最小值为"+minValue1);


        //2)包装类可以将字符串转换为对应的基本类型------熟练掌握
        String s1 = "39";
        int s = Integer.parseInt(s1);
        System.out.println(s);

        String s2 = "123.456";
        double price = Double.parseDouble(s2);
        System.out.println(price);

       /* Integer i1 = new Integer(5);
        Integer i2 = new Integer(5);
        System.out.println(i1==i2);
        System.out.println(i1.equals(i2));

        Integer i3 = Integer.valueOf(5);
        Integer i4 = Integer.valueOf(5);
        System.out.println(i3 == i4);
        System.out.println(i3.equals(i4));

        int i = i4.intValue();
        System.out.println(i);*/
    }
}
